package libs;


import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author papi
 */
public interface Attendance {

    /**
     *          It sets student's absence today in specified seminar.
     * 
     * @param   student     Student.
     * @param   seminar     Seminar.
     * @throws  AttendanceException if the seminar doesn't exist
     *          or the student is not registered in seminar.
     * @throws  NullPointerException if some of the arguments is null.
     */
    public void absent (Student student, Seminar seminar) throws AttendanceException;

    /**
     *          It sets student's absence today in specified seminar
     *          on specified day.
     *
     * @param   student     Student.
     * @param   seminar     Seminar.
     * @throws  AttendanceException if the seminar doesn't exist
     *          or the student is not registered in seminar.
     * @throws  NullPointerException if some of the arguments is null.
     */
    public void absent (Student student, Seminar seminar, Date date) throws AttendanceException;

    /**
     *          It adds a seminar to the attendance book.
     * 
     * @param   seminar     Seminar
     * @return  TRUE if the seminar has been added,
     *          FALSE if the seminar has already existed.
     * @throws  NullPointerException if the seminar is null.
     */
    public boolean addSeminar (Seminar seminar);

    /**
     *          It adds a student to the seminar.
     *          If the student has been already registered in another seminar,
     *          his/her registration in another seminar will be canceled.
     * 
     * @param   student     Student.
     * @param   seminar     Seminar.
     * @return  TRUE if the student has been added,
     *          FALSE if the student has been already registered in this seminar.
     * @throws  AttendanceException if the seminar does not exist.
     * @throws  NullPointerException if some of the arguments is null.
     */
    public boolean addStudent (Student student, Seminar seminar) throws AttendanceException;

    /**
     *          It changes attendance on the specified day.
     *          If the student was absent, it changes on present and vica versa.
     *
     * @param   student     Student
     * @param   seminar     Student
     * @param   date        Date.
     * @throws  NullPointerException if some of the arguments is null.
     * @throws  AttendanceException if the seminar does not exist,
     *          the student is not registered in the seminar
     *          or he/she has no presence/absence on the specified day.
     */
    public void changeAttendace (Student student, Seminar seminar, Date date) throws AttendanceException;

    /**
     *          It returns the absence of the students in the seminars.
     *
     * @param   seminar     Seminar.
     * @return  Students and dates when the students were absent.
     * @throws  NullPointerException if the seminar is null.
     */
    public Map<Student,Set<Date>> getAbsence (Seminar seminar);

    /**
     *          It returns the presence of the students in the seminars.
     *
     * @param   seminar     Seminar.
     * @return  Students and dates when the students were present.
     * @throws  NullPointerException if the seminar is null.
     */
    public Map<Student,Set<Date>> getPresence (Seminar seminar);

    /**
     *          It returns all seminar groups.
     * 
     * @return  Seminar groups.
     */
    public Set<Seminar> getSeminars ();

    /**
     *          It returns seminar groups of the subject.
     *
     * @param   subject Subject
     * @return  Seminar groups.
     * @throws  NullPointerException if the subject is null.
     */
    public Set<Seminar> getSeminars (Subject subject);

    /**
     *          It returns all registered students.
     *
     * @return  All registered students.
     */
    public Set<Student> getStudents();

    /**
     *          It returns students of the seminar group.
     *
     * @param   seminar Seminar.
     * @return  Students of the seminar group.
     * @throws  NullPointerException if the seminar is null.
     */
    public Set<Student> getStudents (Seminar seminar);

    /**
     *          It loads persistent data.
     */
    public void load ();

    /**
     *          It set presence of the student today.
     * 
     * @param   student Student.
     * @param   seminar Seminar.
     * @throws  NullPointerException if some of the arguments is null.
     * @throws  AttendanceException if the seminar does not exist
     *          or the student is not registered in the seminar.     *
     */
    public void present (Student student, Seminar seminar) throws AttendanceException;

    /**
     *          It set presence of the student on specified day.
     *
     * @param   student Student.
     * @param   seminar Seminar.
     * @throws  NullPointerException if some of the arguments is null.
     * @throws  AttendanceException if the seminar does not exist
     *          or the student is not registered in the seminar.     *
     */
    public void present (Student student, Seminar seminar, Date date) throws AttendanceException;

    /**
     *          It removes the seminar.
     *
     * @param   seminar Seminar
     * @return  TRUE if the seminar existed, otherwise FALSE.
     * @throws  NullPointerException if the seminar is null.
     */
    public boolean removeSeminar (Seminar seminar);

    /**
     *          It removes student from the seminar
     *
     * @param   student Student.
     * @param   seminar Seminar.
     * @return  TRUE if the student was registered in seminar,
     *          otherwise FALSE.
     * @throws  NullPointerException if some of the arguments is null.
     */
    public boolean removeStudent (Student student, Seminar seminar);

    /**
     *          It removes student from all seminars.
     * 
     * @param   student Student
     * @return  TRUE if the student was registered in some seminar,
     *          otherwise FALSE.
     */
    public boolean removeStudent (Student student);

    /**
     *          It saves data.
     */
    public void save ();

}

